<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>系统功能</title>
	<link rel="stylesheet" type="text/css" href="${ctx}/themes/gray/easyui.css">
	<link rel="stylesheet" type="text/css" href="${ctx}/themes/icon.css">
	<script type="text/javascript" src="${ctx}/script/jquery.min.js"></script>
	<script type="text/javascript" src="${ctx}/script/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="${ctx}/script/lhgdialog/lhgdialog.min.js?s=facebook"></script>
	<script type="text/javascript" src="${ctx}/script/CheckText.js"></script>
	<script type="text/javascript">
		var dg = frameElement.lhgDG;
		dg.addBtn( 'ok', '确定', function(){
			if (!checkFormItem(document.getElementById("jgmc"),"C",200,0,1,"机构名称")) return false;
			if (!checkFormItem(document.getElementById("sybz"),"N",2,0,1,"使用标志")) return false;
			submitForm();
		});
		
		function submitForm() {
			var pSjjg = $("#sjjg").val();
			var pId = $("#jgbh").val();
			var pJgmc= $("#jgmc").val();
			var pSybz= $("#sybz").val();
			var params = {
				"sjjg.jgbh" : pSjjg,
				"gg_jgbh.jgbh" : pId,
				"gg_jgbh.jgmc" : pJgmc,
				"gg_jgbh.sybz" : pSybz
			};
			var actionUrl = "saveGG_JGBH.action";
			$.ajax( {
				url : actionUrl,
				data : params,
				dataType : "json",
				cache : false,
				error : function(textStatus, errorThrown) {alert("系统ajax交互错误: " + textStatus);},
				success : function(data, textStatus) {
					if (data.ajaxResult == "success") {
						if(pId == "") {
							var newNode = [{id:data.gg_jgbh.jgbh, name:data.gg_jgbh.jgmc, fid:data.sjjg.jgbh}];
							dg.curWin.addTreeNode(data.sjjg.jgbh,newNode);
							new dg.curWin.$.dialog({id:'2',title:'信息提示页面',page:'${ctx}/success.jsp',rang:true,iconTitle:false}).ShowDialog();
							dg.cancel();
						} else {
							dg.curWin.updateTreeNode(data.gg_jgbh.jgbh,data.gg_jgbh.jgmc);
							new dg.curWin.$.dialog({id:'2',title:'信息提示页面',page:'${ctx}/success.jsp',rang:true,iconTitle:false}).ShowDialog();
							dg.cancel();
						}
					} else {
						dg.curWin.alert("操作失败!");
					}
				}
			});
		}
	</script>
</head>
<body>
<form id="ff" method="post">
<input type="hidden" id ="sjjg" name="sjjg.jgbh" value="${sjjg.jgbh}">
<input type="hidden" id ="jgbh" name="gg_jgbh.jgbh" value="${gg_jgbh.jgbh}">
<table id="tt" title="机构信息" iconCls="icon-title">
	<tbody>
	<tr>
		<td>机构名称：</td>
		<td><input id="jgmc"  name="gg_jgbh.jgmc" style="width:200px;" value="${gg_jgbh.jgmc}"></td>
	</tr>
	<tr>
		<td>使用标志：</td>
		<td>
			<select id="sybz" name="gg_jgbh.sybz" style="width:206px;">
				<option value="1">在用</option>
				<option value="0">停用</option>
			</select>
		</td>
	</tr>
	</tbody>
</table>
</form>
</body>
</html>